<?php
/**
 * Created by PhpStorm.
 * User: 13469
 * Date: 2018/12/7
 * Time: 15:18
 */
include "config.php";
if(isset($_REQUEST["cname"])&&isset($_REQUEST["ctel"])){
    $cName=$_REQUEST["cname"];
    $cTel=$_REQUEST["ctel"];
    $datastr=file_get_contents("data/data.json");
    $dataArr=json_decode($datastr);
    for($i=0;$i<count($dataArr);$i++){
        if($dataArr[$i]->c_name==$cName&&$dataArr[$i]->c_tel==$cTel){
            print_r(json_encode(array("status"=>-1,"msg"=>"公司名已存在，不能注册")));
        }else{
            print_r(json_encode(array("status"=>1,"msg"=>"公司名可以注册")));
        }
    }

}else{
    print_r(json_encode(array("status"=>0,"msg"=>"请输入公司名或手机号")));
}
